//
//  TDViewController.m
//  iosf
//
//  Created by Yuan Ye on 12-4-5.
//  Copyright (c) 2012年 Neusoft Corporation. All rights reserved.
//

#import "TDViewController.h"
#import "TDModalPanel.h"
#import "TDModalPanelViewController.h"
#import "TDNavigationController.h"

@interface TDViewController ()

@end

@implementation TDViewController

@synthesize demoViewController = _demoViewController;

-(void)dealloc{
    self.demoViewController = nil; //NI_RELEASE_SAFELY(_demoViewController);
    [super dealloc];
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    TDModalPanelViewController *controller = [[TDModalPanelViewController alloc]init];
    UINavigationController *navigationController = [[TDNavigationController alloc] initWithRootViewController:controller];
    navigationController.cornerRadius = 10.0f;
    navigationController.view.autoresizingMask = UIViewAutoresizingNone;
    navigationController.view.frame = CGRectMake(40, 40, 320, 420);
    self.demoViewController = navigationController;
    controller.view.frame = navigationController.view.bounds;
    
    TDModalPanel *panel = [[TDModalPanel alloc] initWithFrame:CGRectMake(10, 10, 400, 500)];
    panel.autoresizingMask = UIViewAutoresizingNone;
    [panel addSubview:navigationController.view];
    [self.view addSubview:panel];
    NI_RELEASE_SAFELY(panel);
    NI_RELEASE_SAFELY(controller);
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return YES;
}

@end
